/*
 * Created By Visual Studio 2005
 * Create by: daqingshu
 * Create at: 2006-10-21 0:40:48{DATE}
 * Organization: BIT
 * 
 *
 */


using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
using System.Data;

namespace Adge.BLL
{
    [DataObject(true)]
    public class EntityDataObject<T> where T : class
    {
        [DataObjectMethod(DataObjectMethodType.Select, true)]
        public static IList<T> SelectAll()
        {
            AdgeArBase<T> entity = new AdgeArBase<T>();
            try
            {
                return entity.FindAll();
            }
            catch
            {
                return new List<T>();
            }
        }

        [DataObjectMethod(DataObjectMethodType.Insert, true)]
        public static bool Insert(T info)
        {
            AdgeArBase<T> entity = new AdgeArBase<T>();
            return entity.Save(info);
        }

        [DataObjectMethod(DataObjectMethodType.Update, true)]
        public static bool Save(T info)
        {
            AdgeArBase<T> entity = new AdgeArBase<T>();
            return entity.Save(info);
        }

        [DataObjectMethod(DataObjectMethodType.Delete, true)]
        public static bool Delete(int objId)
        {
            AdgeArBase<T> entity = new AdgeArBase<T>();
            return entity.Delete(objId);
        }

    }
}
